package com.link2room.rodimus.entity;

import com.link2room.common.dto.result.base.UserPassrodEntity;
import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by LN on 2016/9/8.
 */
@Entity
@Table(name = "member_base",  catalog = "")
@DynamicInsert
public class MemberBase extends BaseEntity implements UserPassrodEntity {
    public enum MemberBase_{
        mobile,openid,lhotelGroupCode
    }
    private String memberName;
    private String password;
    private String memberLevel;
    private String memberNo;
    private String openid;
    private String mobile;
    private String sex;
    private String isbindPms;
    public MemberBase(){

    }
    public MemberBase(String mobile){
        setMobile(mobile);
    }
    @Basic
    @Column(name = "member_name", nullable = true, length = 32)
    public String getMemberName() {
        return memberName;
    }

    public void setMemberName(String memberName) {
        this.memberName = memberName;
    }

    @Basic
    @Column(name = "password", nullable = true, length = 32)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "member_level", nullable = true, length = 16)
    public String getMemberLevel() {
        return memberLevel;
    }

    public void setMemberLevel(String memberLevel) {
        this.memberLevel = memberLevel;
    }
    @Basic
    @Column(name = "member_No", nullable = true, length = 16)
    public String getMemberNo() {
        return memberNo;
    }

    public void setMemberNo(String memberNo) {
        this.memberNo = memberNo;
    }
    @Basic
    @Column(name = "openid", nullable = true, length = 64)
    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }
    @Basic
    @Column(name = "mobile", nullable = true, length = 32)
    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Basic
    @Column(name = "sex", nullable = true, length = 2)
    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
    @Basic
    @Column(name = "isbind_pms", nullable = true, length = 2)
    public String getIsbindPms() {
        return isbindPms;
    }

    public void setIsbindPms(String isbindPms) {
        this.isbindPms = isbindPms;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MemberBase that = (MemberBase) o;

        if (memberName != null ? !memberName.equals(that.memberName) : that.memberName != null) return false;
        if (password != null ? !password.equals(that.password) : that.password != null) return false;
        if (memberLevel != null ? !memberLevel.equals(that.memberLevel) : that.memberLevel != null) return false;
        if (memberNo != null ? !memberNo.equals(that.memberNo) : that.memberNo != null) return false;
        if (openid != null ? !openid.equals(that.openid) : that.openid != null) return false;
        if (mobile != null ? !mobile.equals(that.mobile) : that.mobile != null) return false;
        if (sex != null ? !sex.equals(that.sex) : that.sex != null) return false;
        return isbindPms != null ? isbindPms.equals(that.isbindPms) : that.isbindPms == null;
    }

    @Override
    public int hashCode() {
        int result = memberName != null ? memberName.hashCode() : 0;
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (memberLevel != null ? memberLevel.hashCode() : 0);
        result = 31 * result + (memberNo != null ? memberNo.hashCode() : 0);
        result = 31 * result + (openid != null ? openid.hashCode() : 0);
        result = 31 * result + (mobile != null ? mobile.hashCode() : 0);
        result = 31 * result + (sex != null ? sex.hashCode() : 0);
        result = 31 * result + (isbindPms != null ? isbindPms.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "MemberBase{" +
                "memberName='" + memberName + '\'' +
                ", password='" + password + '\'' +
                ", memberLevel='" + memberLevel + '\'' +
                ", memberNo='" + memberNo + '\'' +
                ", openid='" + openid + '\'' +
                ", mobile='" + mobile + '\'' +
                ", sex='" + sex + '\'' +
                ", isbindPms='" + isbindPms + '\'' +
                "} " + super.toString();
    }
}
